|
|
|
|
|
|
|
Listing 12.11. Adding the BoundText property. |
|
|
|
|
|
|
|
|
Public Property Get BoundText() As Variant
'
BoundText = frmFind.DBList1.BoundText
'
End Property
Public Property Let BoundText(ByVal vNewValue As Variant)
'
frmFind.DBList1.BoundText = vNewValue
'
End Property |
|
|
|
|
|
|
|
|
Now save the control (DBFIND.CTL) and the project (DBFINDCTL.VBP) before continuing. |
|
|
|
|
|
|
|
|
The next set of routines handles some basics of custom control management. These routines exist in almost all custom controls. First, you need to add a routine to save the design-time state of the custom properties. This ensures that the values you set at design time are avail-able to the runtime version of the control. Add the code in Listing 12.12 to the UserControl_WriteProperties event. |
|
|
|
|
|
|
|
|
Listing 12.12. Coding the WriteProperties event of the User control. |
|
|
|
|
|
|
|
|
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
'
' save design-time vars
'
With PropBag
.WriteProperty "Connect", strConnect, ""
.WriteProperty "DatabaseName", strDBName, ""
.WriteProperty "RecordSource", strRSName, ""
.WriteProperty "ListField", strListField, ""
.WriteProperty "BoundColumn", strBoundColumn, ""
End With
'
End Sub |
|
|
|
|
|
|
|
|
Next, you need to add the routine that reads the saved values. This event occurs when the runtime version of the control first begins. Add the code from Listing 12.13 to the UserControl_ReadProperties event. |
|
|
|
|
|